package(default_visibility = ["//visibility:public"])

exports_files(["only_keep_nv.lds"])

genrule(
    name = "generate_nvidia_syms",
    srcs = ["gen_nvidia_syms.sh"],  # The script that generates the source file
    outs = ["nvidia_syms.h"],  # The expected output source file
    cmd = "$(location gen_nvidia_syms.sh) $(@D)/nvidia_syms.h",
)

cc_library(
    name = "nvidia_hook",
    srcs = [
        "hook.cc",
    ],
    hdrs = [
        "hook.h",
        ":generate_nvidia_syms",
    ],
    linkstatic = 1,
    deps = [
        "//xpu_timer",
        "//xpu_timer:macro",
        "//xpu_timer:manager",
        "//xpu_timer:util",
        "@apache_brpc//:bvar",
        "@cuda//:cuda_headers",
    ],
    alwayslink = True,
)
